﻿Imports System
Imports System.Collections
Imports Microsoft.VisualBasic
Namespace ServerManagement
    <Serializable()> _
    Public Structure Server
        Dim name As String
        Dim address As String
        Dim port As String
        Dim username As String
        Dim password As String
    End Structure
    <Serializable()> _
    Public Class ServerCollection
        Inherits CollectionBase
        Dim Stuff As Integer
        Event FeedAddedSuccessfully()
        Default Public Property Item(ByVal index As Integer) As Server
            Get
                Return CType(List(index), Server)
            End Get
            Set(ByVal Value As Server)
                List(index) = Value
            End Set
        End Property
        Public Function Add(ByVal value As Server) As Integer
            Return List.Add(value)
        End Function
        Public Function IndexOf(ByVal value As Server) As Integer
            Return List.IndexOf(value)
        End Function
        Public Sub Insert(ByVal index As Integer, ByVal value As Server)
            List.Insert(index, value)
        End Sub
        Public Sub Remove(ByVal value As Server)
            List.Remove(value)
        End Sub
        Public Function Contains(ByVal value As Server) As Boolean
            Return List.Contains(value)
        End Function
        Public Property GetItemCount() As Integer
            Get
                Return Stuff
            End Get
            Set(ByVal Value As Integer)
                Stuff = Value
            End Set
        End Property
        Function Find(ByVal itemTitle As String) As Server
            Try
                Dim ItemReturn As New Server
                Dim Item As New Server
                For Each Item In Me.List
                    Dim A As String = Item.name
                    If LCase(Item.name) = LCase(itemTitle) Then
                        ItemReturn = Item
                        Return ItemReturn
                        Exit For
                    End If
                Next
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
            Return Nothing
        End Function
    End Class
End Namespace
